﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OracleClient;
using System.Data;
public partial class users_add : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        OracleConnection con = new OracleConnection("Data Source=orcl;Persist Security Info=True;User ID=booksale;Password=Qwertyuiop1;Unicode=True");
        string sql = "insert into  Book_Stack  values('" + num.Text + "','" + name.Text + "'," + count.Text + "," + knum.Text + ",'" + leibie.Text + "')";
         
        OracleCommand com = new OracleCommand(sql,con);

        if (con.State.Equals(ConnectionState.Closed))
        { con.Open(); }
    
        int order=Convert.ToInt32(com.ExecuteNonQuery());
             if (order > 0)
             { Response.Write("<script language=javascript>alert('添加成功')</script>"); }
             else
             { Response.Write("<script language=javascript>alert('添加失败')</script>"); }
        if (con.State.Equals(ConnectionState.Open))
        { con.Close(); }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        num.Text = name.Text = count.Text = knum.Text =leibie.Text = " ";
    }
}